home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / PASSDK30.ZIP;1 / DISK1.ZIP / PAS / CDROMAPP / CDRESET.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-08  |  1.2 KB  |  75 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <dos.h>
  4.  
  5. #define OKAY 0
  6.  
  7. #include "cdmaster.h"
  8.  
  9. char *syntax= "Syntax: cdreset [drive #].\n";
  10. char *nodrives= "No CDROM drives attached.\n";
  11. char *nomscdex= "MSCDEX is not installed.\n";
  12.  
  13. char *copyright= "cdreset.exe - Copyright Media Vision, 1992\n";
  14. char *programmer= "Bart Crane";
  15.  
  16. main(int argc, char **argv)
  17. {
  18.     int numcdroms= 0;
  19.     int ourdrive= 0;
  20.     struct cdtable *cdt;
  21.  
  22.     if (!ismscdex())
  23.         {
  24.         fprintf(stderr, nomscdex);
  25.         return(1);
  26.         }
  27.  
  28.     if (!(numcdroms= getnumcdroms()))
  29.         {
  30.         fprintf(stderr, nodrives);
  31.         return(2);
  32.         }
  33.  
  34.     switch (argc)
  35.         {
  36.         case 2:
  37.             if (argv[1][0] != '.')
  38.                 {
  39.                 if (!(ourdrive= atoi(argv[1])))
  40.                     {
  41.                     fprintf(stderr, syntax);
  42.                     return(3);
  43.                     }
  44.                 break;
  45.                 }
  46.  
  47.         case 1:
  48.             if (!(ourdrive= getfirstcdrom()))
  49.                 {
  50.                 fprintf(stderr, nodrives);
  51.                 return(4);
  52.                 }
  53.             break;
  54.  
  55.         default:
  56.             fprintf(stderr, syntax);
  57.             return(5);
  58.         }
  59.  
  60.     printf("reset drive: %2d ", ourdrive);
  61.  
  62.     if (cdt= createaudiotoc(ourdrive))
  63.         {
  64.         int status= cdreset(ourdrive);
  65.         printf("= %X.\n", status);
  66.         destroyaudiotoc(ourdrive);
  67.         }
  68.     else
  69.         printf("failed, no initialization.\n");
  70.  
  71.     return(OKAY);
  72. }
  73.  
  74.  
  75.